<?php $this->load->view("general/header");?>
<div id="customer" class="page_">
    <div class="form">              
        <div class="form_header"><a href="<?php echo site_url('car/view');?>">Lihat Daftar Mobil</a> &rarr; <a href="<?php echo site_url('car/edit/' . $id);?>">Ubah Data Mobil</a></div>
        <div class="content_dataS">
         <form method="post" action="<?php echo site_url("car/edit/". $id);?>">
            <div class="content_dataR">
           		
               
                <div class="row">
                    <div class="col1"></div>
                    <div class="col2"> 
                        <div class="errorField"></div>
                    </div>
                </div>
                
                <div class="row">
                    <div class="col1">Tarif/Hari Mobil</div>
                    <div class="col2"><input type="text" name="tarif" style="text-align:right" value="<?php foreach($price as $price1){
																				if($price1['keterangan']=="Harian"){
																					echo $price1['price'];
																				}
																			 }?>"/> 
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                    </div>
                </div>  
                <div class="row">
                    <div class="col1">Tarif Mingguan</div>
                    <div class="col2"><input type="text" name="tarifminggu" style="text-align:right" value="<?php foreach($price as $price1){
																				if($price1['keterangan']=="Mingguan"){
																					echo $price1['price'];
																				}
																			 }?>"/> 
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                	</div>
                </div>
                <div class="row">
                    <div class="col1">Tarif Bulanan</div>
                    <div class="col2"><input type="text" name="tarifbulan" style="text-align:right" value="<?php foreach($price as $price1){
																				if($price1['keterangan']=="Bulanan"){
																					echo $price1['price'];
																				}
																			 }?>"/> 
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col1">Tarif 6 Bulanan</div>
                    <div class="col2"><input type="text" name="tarif6bulan" style="text-align:right" value="<?php foreach($price as $price1){
																				if($price1['keterangan']=="6 Bulanan"){
																					echo $price1['price'];
																				}
																			 }?>"/> 
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col1">Tarif Tahunan</div>
                    <div class="col2"><input type="text" name="tariftahun" style="text-align:right" value="<?php foreach($price as $price1){
																				if($price1['keterangan']=="Tahunan"){
																					echo $price1['price'];
																				}
																			 }?>"/> 
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col1">Harga Car CDF</div>
                    <div class="col2"><input type="text"id="mdfmobil" name="mdffuel" style="text-align:right" onkeyup="javascript: hargamdf()" value="<?php foreach($price as $price1){
						if($price1['keterangan']=="Paket CDF"){
							$hargaR =$price1['price']-$mdf['0']['supir']-$mdf['0']['fuel'];
							echo $hargaR;
						}
					 }?>"/> 
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                    </div>
                </div>
                 <div class="row">
                    <div class="col1">Harga Supir CDF</div>
                    <div class="col2"><input type="text" id="mdfsupir" name="mdfsupir" value="<?php echo number_format($mdf['0']['supir'], 0, '.', ',');?>" readonly="readonly" style="text-align:right" onkeyup="javascript: hargamdf()"/> <a href="#mdfsupirview" onclick="javascript: enabling()">Edit</a>
                        <div class="errorField"><?php echo form_error("tarif");?></div><div id="mdfsupirview"></div>
                    </div>
                </div>      
                <div class="row">
                	<div class="col1">Harga Fuel CDF</div>
                	<div class="col2"><input type="text" name="mdffuel" id="mdffuel" value="<?php echo number_format($mdf['0']['fuel'], 0, '.', ',');?>" readonly="readonly" style="text-align:right" onkeyup="javascript: hargamdf()"/> <a href="#mdffuelview" onclick="javascript: enablingfuel()">Edit</a><div id="mdffuelview" onkeyup="javascript: hargamdf()"></div>
                    	<div class="errorField"><?php echo form_error("tarif");?></div>
                	</div>
           		</div>
                <div class="row">
                    <div class="col1">Harga Paket CDF</div>
                    <div class="col2"><input type="text" name="tarifmdf" id="mdftotal" style="text-align:right" value="<?php foreach($price as $price1){
																				if($price1['keterangan']=="Paket CDF"){
																					echo $price1['price'];
																				}
																			 }?>"/> 
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                </div>
            </div>          
            </div>
            <div  style="border-bottom:solid; width:80%"><strong>Data Mobil</strong></div>
            <div class="row">
            	<div class="col1">Staff</div>
                <div class="col2"><?php echo get_username($this->session->userdata("user_id"));?> 
                	
                </div>
			</div>
            
            <div class="row">
            	<div class="col1">Nomor Polisi</div>
                <div class="col2"><input type="text" name="plat_mobil" value="<?php echo $car['0']['car_license']?>"/> 
                	<div class="errorField"><?php echo form_error("plat_mobil");?></div>
                </div>
			</div>

            <div class="row">
            	<div class="col1">Produsen</div>
                <div class="col2" id="produsenPlace">
                	<select id="produsen" name="produsen">
                    <option value="" selected="selected">Pilih nama produsen</option>
                    	<?php foreach ($produsen as $produsen1){?>
                        	
                            <option <?php if ($produsen1['nama']==$car['0']['produsen']){;?> selected="selected" <?php }?> value="<?php echo $produsen1['nama']?>"><?php echo $produsen1['nama']?></option>
                        <?php } ?>
                    </select>
                	
                </div><div class="errorField"><img src="<?php echo base_url();?>image_tinymce/add.jpg" id="refreshimgProd"/></div>
			</div>
            <div class="row">
            	<div class="col1">Tipe</div>
                <div class="col2">
               	 	<select id="tipe" name="tipe">
                    	<?php if($car['0']['type']=="Sedan"){?>
                        	<option value="Sedan" selected="selected">Sedan</option>
                            <option value="MPV">MPV</option>
                        	<option value="SUV">SUV</option>
                        <?php } elseif($car['0']['type']=="MPV"){?>
                        	<option value="Sedan">Sedan</option>
                            <option value="MPV" selected="selected">MPV</option>
                        	<option value="SUV">SUV</option>
                        <?php }else{?>
                            <option value="Sedan">Sedan</option>
                            <option value="MPV">MPV</option>
                        	<option value="SUV" selected="selected">SUV</option>
                        <?php }?> 
                                            
                    </select>
                	<div class="errorField"><?php echo form_error("tipe");?></div>
                </div>
			</div>
            <div class="row">
            	<div class="col1">Model</div>
                <div class="col2"><input type="text" name="model" value="<?php echo $car['0']['model']?>"/> 
                	<div class="errorField"><?php echo form_error("model");?></div>
                </div>
			</div>
        	<div class="row">
            	<div class="col1">Series</div>
                <div class="col2"><input type="text" name="nama_mobil" value="<?php echo $car['0']['car_name']?>"/> 
                	<div class="errorField"><?php echo form_error("nama_mobil");?></div>
                </div>
            </div>
			<div class="row">
            	<div class="col1">Warna Mobil</div>
                <div class="col2"><input type="text" name="warna" value="<?php echo $car['0']['warna']?>"/> 
                	<div class="errorField"><?php echo form_error("warna");?></div>
                </div>
			</div>
           	<div class="row">
                <div class="col1">Daya Angkut</div>
                <div class="col2">
                	<select id="daya" name="daya">
                    	<option value="" >Pilih daya angkut</option>
                    	<?php if($car['0']['daya']=="5"){?>
                        	<option value="5" selected="selected">5 Orang</option>
                            <option value="7">7 Orang</option>
                            <option value="10">10 Orang</option>
                            <option value="12">12 Orang</option> 
                        <?php } elseif($car['0']['daya']=="7"){?>
                        	<option value="5">5 Orang</option>
                            <option value="7"  selected="selected">7 Orang</option>
                            <option value="10">10 Orang</option>
                            <option value="12">12 Orang</option>
                        <?php } elseif($car['0']['daya']=="10"){?>
                        	<option value="5">5 Orang</option>
                            <option value="7">7 Orang</option>
                            <option value="10" selected="selected">10 Orang</option>
                            <option value="12">12 Orang</option> 
                        <?php }else{?>
                            <option value="5">5 Orang</option>
                            <option value="7">7 Orang</option>
                            <option value="10">10 Orang</option>
                            <option value="12" selected="selected">12 Orang</option> 
                        <?php }?> 
                   	</select> 
                    <div class="errorField"><?php echo form_error("daya");?></div>
                </div>
            </div>
            <div class="row">
                <div class="col1">Mesin</div>
                <div class="col2"><input type="text" name="mesin" value="<?php echo $car['0']['mesin']?>"/> cc
                    <div class="errorField"><?php echo form_error("mesin");?></div>
                </div>
            </div>
            <div class="row">
                <div class="col1">Transmisi</div>
                <div class="col2">
                	<select id="transmisi" name="transmisi">
                    	 <option value="" >Pilih jenis transmisi</option>
                    	<?php if($car['0']['transmisi']=="Automatic"){?>
                        	<<option value="Automatic" selected="selected">Automatic</option>
                    		<option value="Manual">Manual</option>  
                        <?php }else{?>
                            <<option value="Automatic">Automatic</option>
                    		<option value="Manual" selected="selected">Manual</option> 
                        <?php }?> 
                        
                        
                       
                                      
                    </select> 
                    <div class="errorField"><?php echo form_error("transmisi");?></div>
                </div>
            </div>          
            <div class="row">
                <div class="col1">Bahan bakar</div>
                <div class="col2">
                	<select id="bensin" name="bensin">
                    	<option value="" >Pilih jenis bahan bakar</option>
                    	<?php if($car['0']['bensin']=="Premium"){?>
                        	<option value="Premium" selected="selected">Premium</option>
                            <option value="Pertamax">Pertamax</option>  
                            <option value="Bio Solar">Bio Solar</option> 
                        <?php } elseif($car['0']['bensin']=="Pertamax"){?>
                        	<option value="Premium">Premium</option>
                            <option value="Pertamax" selected="selected">Pertamax</option>  
                            <option value="Bio Solar">Bio Solar</option>
                        <?php }else{?>
                           <option value="Premium">Premium</option>
                            <option value="Pertamax">Pertamax</option>  
                            <option value="Bio Solar" selected="selected">Bio Solar</option>
                        <?php }?> 
                                    
                    </select>
                    <div class="errorField"><?php echo form_error("bensin");?></div>
                </div>
            </div>
        	<div class="row">
                    <div class="col1">Agency/Owner</div>
                    <div class="col2">
                    	<select id="nama_pemilik" name="nama_pemilik">
                            <?php if($car['0']['kepemilikan']=="rent"){
									foreach ($owner as $owner1){
									if($owner1['owner_id']==$car['0']['owner_id']){?>
										<option value="<?php echo $owner1['owner_id'];?>" selected="selected"><strong><?php echo $owner1['owner_name'];?></option>
									<?php }else{?>
									<option value="<?php echo $owner1['owner_id'];?>"><strong><?php echo $owner1['owner_name'];?></option>								<?php }	
								}
                            } else{
								 foreach ($ownerLsg as $ownerLsg1){
									if($ownerLsg1['owner_id']==$car['0']['owner_id']){?>
										<option value="<?php echo $ownerLsg1['owner_id'];?>" selected="selected"><strong><?php echo $ownerLsg1['owner_name'];?></option>
									<?php }else{?>
									<option value="<?php echo $ownerLsg1['owner_id'];?>"><strong><?php echo $ownerLsg1['owner_name'];?></option>								<?php }	
								 }
							}?>
                    	</select>
                        <div class="errorField"><?php echo form_error("tarif");?></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col1">Tahun Pembuatan</div>
                    <div class="col2"><input type="text" name="tahun" value="<?php echo $car['0']['pembuatan']?>"/> 
                        <div class="errorField"><?php echo form_error("tahun");?></div>
                    </div>
                </div>

                <div class="row">
                    <div class="col1">Masa Berlaku STNK</div>
                    <div class="col2">
                    	<?php $tgl = explode("-", $car['0']['masa_stnk']);?>
                   		 Tgl 
                        <select id="tgl" name="tgl" style="width:18%">
                            <?php for($i=1;$i<32;$i++){
                                if($i==$tgl[2]){?>
                                    <option value="<?php if($i<10){echo 0;} echo $i;?>" selected="selected"><?php echo $i;?></option>
                                <?php }else{?>
                                    <option value="<?php if($i<10){echo 0;} echo $i;?>"><?php echo $i;?></option>
                                <?php } //end else
                            } //end for?>                   
                        </select>
                        
                         Bln 
                        <select id="bln" name="bln" style="width:18%">
                            <?php for($i=1;$i<13;$i++){
                                if($i==$tgl[1]){?>
                                    <option value="<?php if($i<10){echo 0;} echo $i;?>" selected="selected"><?php echo $i;?></option>
                                <?php }else{?>
                                    <option value="<?php if($i<10){echo 0;} echo $i;?>"><?php echo $i;?></option>
                                <?php } //end else
                            } //end for?>                   
                        </select>
                        
                        Thn
                        <select id="thn" name="thn" style="width:30%">
                            <?php for($i=date("Y")-10;$i<date("Y")+10;$i++){
                                if($i==$tgl[0]){?>
                                    <option value="<?php echo $i;?>" selected="selected"><?php echo $i;?></option>
                                <?php }else{?>
                                    <option value="<?php echo $i;?>"><?php echo $i;?></option>
                                <?php } //end else
                            } //end for?>                   
                        </select>
                        <div class="errorField"><?php echo form_error("masa_stnk");?></div>
                    </div>
                </div>
        </div>   
        <div class="title" align="right">
            <input type="submit" name="btnSave" value="Save" class="button_red" />
        </div>
        <div class="success"><?php echo (isset($success))?$success:"";?>&nbsp;</div>
        </form>
        </div>
        
         <div id="dialog-formProdusen" title="Tambah Data Produsen Mobil">
    	<p class="validateTips">Harus diisi</p>
 
            <form>
            <fieldset>
                <label for="name">Nama Produsen</label>
                <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
               
            </fieldset>
            </form>
        </div>
    </div>
</div>
<?php $this->load->view("general/footer");?>


